#! /usr/bin/python
#! coding:utf-8
"""L = [x * x for x in range(10)]
print(L)

g  = (x * x for x in range(10))
print(g)

print(next(g))

print(next(g))

print(next(g))

print(next(g))


g  = (x * x for x in range(10))
for n in g:
    print(n)

def fib(m):
    n, a, b, = 0, 0, 1
    while n < m :
        print(b, end='-')
        a, b = b ,a+b
        n = n +1
    return 'done'

fib(10)
"""

def fib1(m):
    n, a, b, = 0, 0, 1
    while n < m :
        yield b
        a, b = b ,a+b
        n = n +1
    return 'done'

g = fib1(10)

for x in g:
    print(x)

"""
g = fib1(10)

for n in g:
    print(next(g))
"""

"""def fib(m):
    n, a, b, = 0, 0, 1
    while n < m :
        yield b
        a, b = b ,a+b
        n = n +1
    return 'done'

for n in fib(6):
    print(n)"""

def generate(self, numRows):
        """
        :type numRows: int
        :rtype: List[List[int]]
        """
        if numRows==0:
            return []
        if numRows==1:
            return[[1]]
        if numRows==2:
            return [[1],[1,1]]
        numRows -= 2
        rList = [[1],[1,1]]
        while numRows>0:
            newList = [1]
            for i in range(len(rList[-1])-1):
                newList.append(rList[-1][i]+rList[-1][i+1])
            newList.append(1)
            rList.append(newList)
            numRows -= 1
        return rList

def YHsj(row):
    result = [1]
    n = 0
    while n < row:
        if n < 1:
            yield result
        else:
            a = 1
            #t = tuple(x for x in result)
            t = [x for x in result]
            result = [1, 1]
            while a < n:
                result.insert(a, t[a-1]+t[a])
                a += 1
            yield result
        n += 1
 
 
g = YHsj(7)
for t in g:
    print(t)
